package com.cljh.mapper;

import com.cljh.bean.UserAddress;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.PutMapping;

import java.util.List;

@Mapper
public interface UserAddressMapper {

    UserAddress selectById(@Param("id")Integer id);

    List<UserAddress> selectByUserId(@Param("id")Integer id);

    @Insert("insert into mtmall_test.user_address (addressee, company, country, detail_address, city, phone, email, remark, user_id) values (#{add.addressee},#{add.company},#{add.country},#{add.detailAddress},#{add.city},#{add.phone},#{add.email},#{add.remark},#{add.userId});")
    int insertAdd(@Param("add")UserAddress add);

    @Delete("delete from mtmall_test.user_address where user_id=#{id};")
    int deleteAdd(Integer id);

    @Delete("delete from mtmall_test.user_address where id=#{id};")
    int deleteById(Integer id);
    int putAdd(@Param("add")UserAddress add);
}
